'''
Created on Jul 4, 2011

@author: vakumar
'''
from random import random
import datetime

def timeit(fn):
    def _timeit(*args, **kwargs):
        t0 = datetime.time()
        

class Utils(object):
    '''
    classdocs
    '''
    count = 0
    
    @classmethod
    def Counter(cls,fun):
        def _counter(*args, **kwargs):
            Utils.count += 1
            return fun(*args, **kwargs)
        return _counter


    def __init__(self):
        pass
    
    @staticmethod
    def comparator():
        Utils.count = 0
        @Utils.Counter
        def compare(i, j , equal = True):
            if equal:
                return True if i <= j else False
            else:
                return True if i < j else False
        return compare
    
    @staticmethod
    def getrandomintlist(size, limit = 10000, nodups = False):
        ls = []
        while size > 0:
            ls.append(int(random()*limit))
            size -= 1
        if nodups:
            t = set(ls)
            ls = list(t)
        return ls 
    
    @staticmethod
    def swapval(i, j, arr = None):
        if arr:
            return (arr[j],arr[i])
        return (j,i)
    
  
    
    @staticmethod
    def Label():
        pass